FMI Ticket System
| Kamen Mladenov | FMI Computer Science Year 1 Group 6 | Project 1 | Project Topic 4 |
Public Member Functions | List of all members
Ticket Class Reference

Each Ticket contains a row and a seat number. More...

#include <Ticket.h>

Public Member Functions

 Ticket ()
 Sets row and seat to zeroes.
 
 Ticket (unsigned row, unsigned seat)
 Sets row and seat.
 
unsigned get_row () const
 Returns row.
 
unsigned get_seat () const
 Returns seat.
 
void read (std::istream &istr)
 Reads Ticket from stram. More...
 
void write (std::ostream &ostr) const
 Writes Ticket to stream. More...
 
int compare (const Ticket &other) const
 Compares two Tickets. More...
 

Detailed Description

Each Ticket contains a row and a seat number.

Member Function Documentation

◆ compare()

int Ticket::compare ( const Ticket &  other) const

Compares two Tickets.

Returns
If rows are equal, -1 if seat < other.seat, 1 if seat > other.seat, 0 if seat == other.seat, else the same, but for rows

◆ read()

void Ticket::read ( std::istream &  istr)

Reads Ticket from stram.

Parameters
istrAn input stream

Directly reads bytes from stream (calls read() function).

Remarks
Doesn't alter the stream in any other way.
Note
Best used with binary ifstream

◆ write()

void Ticket::write ( std::ostream &  ostr) const

Writes Ticket to stream.

Parameters
ostrAn output stream

Directly writes bytes to stream (calls write() function).

Remarks
Doesn't alter the stream in any other way.
Note
Best used with binary ofstream

The documentation for this class was generated from the following files: